#include<iostream>
using namespace std;
#include<cmath>

#include<fstream>

#include"library.h"

double Omega = 0.27;
double c = 299792458; // m/s
//double c = 3e8;
double H0 = 70000; // m/s / Mpc

double f(double x){

	double y = 1-Omega + Omega * pow(1+x, 3);
	y = 1 /sqrt(y);

	return y;
}

int main(){
	
	cout<<"c/H0 = "<<c/H0<<endl;

	double a=0,b=1;

	int n = 10000;

	ofstream fp("integ-results.txt");

	for( b = 0; b<=10; b+= 0.01 ){
		fp<< b <<"\t" <<  c /H0 * integ_trapzoid(a,b,n,f);
		fp<< "\t" <<  c /H0 * integ_midpoint(a,b,n,f)<<endl;
		//fp<< b <<"\t" <<  integ_trapzoid(a,b,n,f)<<endl;
	}

	fp.close();

	return 0;
}
